# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: spider-mario <spidermario@free.fr>
# Contributor: Daniel Ehlers <danielehlers@mindeye.net>

pkgname=coin-or-clp
pkgver=1.17.9
pkgrel=2
pkgdesc='COIN-OR linear programming solver'
arch=(loong64 x86_64)
url='https://github.com/coin-or/Clp'
license=(EPL)
groups=(coin-or)
depends=(coin-or-asl
         coin-or-coinutils
         coin-or-osi
         gcc-libs
         glibc
         suitesparse)
source=($pkgname-$pkgver.tar.gz::https://github.com/coin-or/Clp/archive/refs/tags/releases/$pkgver.tar.gz)
sha256sums=('b02109be54e2c9c6babc9480c242b2c3c7499368cfca8c0430f74782a694a49f')

build() {
  cd Clp-releases-$pkgver
  ./configure --prefix=/usr \
              --with-cholmod-lib='-lcholmod' \
              --with-cholmod-incdir=/usr/include \
              --with-amd-lib='-lamd' \
              --with-amd-incdir=/usr/include
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool # Fix overlinking
  make
}

check() {
  cd Clp-releases-$pkgver
  make test
}

package() {
  cd Clp-releases-$pkgver
  make DESTDIR="$pkgdir" install
}
